<?php

class games
{
	public $TABLE_NAME = 'Games';
	public $TABLE_COLUMNS = array(
			'id'	=> 'Game_id',
			'name'	=> 'Name'
		);
		
	public $DB = null;
	private $Game_list = null;
	
	function get_list( $refresh = false )
	{
		if ( ( !$this->Game_list ) || ( $refresh ) )
		{		
			$game_list_sql = sprintf( "
					SELECT
						*
					FROM
						`%s`
				",
				$this->TABLE_NAME
				 );
			$game_list_result = $this->DB->db_query( $game_list_sql );
			if ( $game_list_result['num_rows'] )
			{
				$this->Game_list = $game_list_result['data'];
				return $this->Game_list;
			}
			else
			{
				return array();
			}
		}
		else
		{
			return $this->Game_list;
		}
		
		
	}
		
	function __construct( $Dblink )
	{
		if ( $Dblink )
		{
			$this->DB = $Dblink;	
			$this->get_list();
			return true;
		}
		else
		{
			return false;	
		}
	}
}

?>